package com.kejiguan.ui.response;

import com.google.gson.annotations.Expose;
import com.kejiguan.ui.model.MenuItem;
import com.kejiguan.ui.util.CacheDataUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by YYY on 2016/4/30.
 */
public class QueryMenuResponse extends BaseResponse{

    private List<MenuItem> menuItems;

    @Expose
    private List<MenuItem> menuList;

    public List<MenuItem> getMenuList() {
        return menuList;
    }

    public void setMenuList(List<MenuItem> menuList) {
        this.menuList = menuList;
    }

    public void initMenus()
    {
        List<MenuItem> userMenus=new ArrayList<>();
        for (MenuItem menuItem:menuList)
        {
            if (menuItem.getParentId()!=0)
            {
                userMenus.add(menuItem);
            }
        }

        if (null!=userMenus)
        {
            menuItems=userMenus;
        }
    }

    public List<MenuItem> getMenuItems() {
        return menuItems;
    }
}
